<template>
	<div :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
		<div class="layout-view-bg-white">
			<div id="left-panel" class="" style="height: 552px">
				<div id="searchbox" class="clearfix">
					<div id="searchbox-container" style="width: 340px">
						<div id="sole-searchbox-content" class="searchbox-content">
							<input
								@click="searchBoxFocus"
								v-model="searchContent.address"
								id="sole-input"
								class="searchbox-content-common"
								type="text"
								name="word"
								autocomplete="off"
								maxlength="256"
								placeholder="搜地点"
							/>
							<div class="input-clear" title="清空" style="display: block" @click="closeSearchContent"></div>
							<div
								v-if="false"
								class="searchbox-content-button right-button route-button loading-button"
								data-title="疏散路线"
								@click="clickGhLuxian"
							></div>
							<!--搜索提示从数据库查找start-->
							<div v-if="isShowSearchSug" class="ui3-suggest-wrap" id="ui3-suggest-wrap" style="top: 40.9962px; z-index: 1000; display: block;overflow-y: auto;max-height: 552px">
								<div id="ui3-suggest-scroll" style="width: 368px">
									<div @click="setSearchInput(sugItem)" class="ui3-suggest-item" v-for="sugItem in searchSugItems" :key="sugItem.address">
										<a>
											<i class="default">{{ sugItem.address }}</i></a
										>
									</div>
								</div>
							</div>
							
							<!--搜索提示从数据库查找end-->
							<!--搜索起终点提示从数据库查找start-->
							<div v-if="isShowQizhongSug" class="ui3-suggest-wrap" id="ui3-suggest-wrap" style="top: 155.9962px; z-index: 1000; display: block">
								<div id="ui3-suggest-scroll" style="width: 368px">
									<div @click="setQizhongdianInput(sugItem)" class="ui3-suggest-item" v-for="sugItem in searchSugItems" :key="sugItem.address">
										<a
											><i class="default">{{ sugItem.address }}</i></a
										>
									</div>
								</div>
							</div>
							<!--搜索起终点提示从数据库查找end-->
						</div>
						<!--路线start-->
						<div v-if="false" id="route-searchbox-content" class="searchbox-content route-searchbox-content" :class="curRouteIndex">
							<div class="route-header">
								<div class="searchbox-content-common route-tabs">
									<div class="tab-item bus-tab" data-index="bus" @click="changeRouteIndex(event)">
										<i></i>
										<span>大巴</span>
									</div>
									<div class="tab-item drive-tab" data-index="drive" @click="changeRouteIndex(event)">
										<i></i>
										<span>驾车</span>
									</div>
									<div class="tab-item walk-tab" data-index="walk" @click="changeRouteIndex(event)">
										<i></i>
										<span>步行</span>
									</div>
									<div class="tab-item bike-tab" data-index="bike" @click="changeRouteIndex(event)">
										<i></i>
										<span>骑行</span>
									</div>
									<div class="arrow-wrap"></div>
								</div>
								<div
									class="searchbox-content-button right-button cancel-button loading-button"
									data-title="关闭路线"
									data-tooltip="2"
									@click="
										{
											showLuxian = false;
											startGhLuxian.address = '';
											endGhLuxian.address = '';
										}
									"
								></div>
							</div>
							<div class="routebox">
								<div class="searchbox-content-common routebox-content">
									<div class="routebox-revert" title="切换起终点">
										<div class="routebox-revert-icon"></div>
									</div>
									<div class="routebox-inputs">
										<div class="routebox-input route-start">
											<div class="route-input-icon"></div>
											<input
												@click="startGhLuxianFocus"
												v-model="startGhLuxian.address"
												autocomplete="off"
												maxlength="256"
												placeholder="输入起点或在图区上选点"
												class="route-start-input"
												type="text"
											/>
											<div class="input-clear" title="清空" style="display: block" @click="startGhLuxian.address = ''"></div>
											<div class="route-input-add-icon"></div>
										</div>
										<div class="routebox-input route-end">
											<div class="route-input-icon"></div>
											<input
												@click="endGhLuxianFocus"
												v-model="endGhLuxian.address"
												autocomplete="off"
												maxlength="256"
												placeholder="输入终点"
												class="route-end-input"
												type="text"
											/>
											<div class="input-clear" title="清空" style="display: block" @click="endGhLuxian.address = ''"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<!--路线end-->
					</div>
					<button class="searchLeft" id="search-button" data-title="搜索" @click="searchAddr"></button>
					<div id="toast-wrapper">
						<div id="toast">
							<img class="info-tip-img" src="/static/images/transparent.gif" alt="" />
							<span class="info-tip-text"> </span>
						</div>
					</div>
				</div>
				<ul id="cards-level0" class="cardlist"></ul>
				<ul id="cards-level1" class="cardlist"></ul>
				<ul id="cards-level2" class="cardlist"></ul>
			</div>

			<div id="app-right-top">
				<div id="user-center" class="ui3-user-center-wrap" style="visibility: visible">
					<div class="avatar-abstract" style="background-image: url('/static/images/857a6c6863626470616e47cf.jpg')"></div>
					<div class="info-box clearfix" style="display: none">
						<div class="arrow"></div>
					</div>
				</div>
				<div id="message-center" class="has-message">
					<div class="message-center-entrance"></div>
					<div id="message-panel" class="">
						<div class="close-btn-indexpage" title="关闭">×</div>
					</div>
				</div>
				<div id="tool-container" class="toolscontainer flex">
					<div class="w-72 mr-4">
						<el-select v-model="optValue" multiple placeholder="图层选择" clearable @change="onChangeOpt">
							<el-option v-for="item in cities" :key="item.value" :label="item.label" :value="item.value" />
							<template #prefix>
								<img alt="图标" class="w-4 h-4" style="padding: 0px; margin: 0px" src="/favicon.ico" />
							</template>
						</el-select>
					</div>
					<el-select :popper-append-to-body="false"  v-model="toolOptValue" class="w-40" placeholder="工具" clearable @change="onChangeToolOpt">
						<el-option  v-for="item in toolOptions" :key="item.value" :label="item.label" :value="item.value" />
						<template #prefix>
							<i class="icon-gongju iconfont"></i>
						</template>
					</el-select>
				</div>
			</div>
			<div id="echartsMap" style="height: 100%"></div>
		</div>
		<el-dialog  draggable ref="elybdymapDialog" :title="dialogStatus == 'create' ? '创建' : '编辑'" v-model="dialogFormVisible" customClass="customWidth">
			<el-form ref="dataForm" :rules="rules" :model="tempArticleModel" label-position="left" label-width="60px" style="width: 350px">
				<el-form-item :label="t('message.layout.title')" prop="title">
					<el-input v-model="tempArticleModel.title" placeholder="名称为唯一标示,必须与已有不同" />
				</el-form-item>
				<el-row style="margin-bottom: 20px">
					<el-col :span="12">
						<el-form-item label="联系" prop="reviewer">
							<el-input v-model="tempArticleModel.reviewer" placeholder="填写" />
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item :label="t('message.layout.phone')" prop="timestamp">
							<el-input v-model="tempArticleModel.timestamp" placeholder="填写" />
						</el-form-item>
					</el-col>
				</el-row>

				<el-row style="margin-bottom: 20px">
					<el-col :span="12">
						<el-form-item label="区域" prop="status">
							<el-select v-model="tempArticleModel.status" class="filter-item" placeholder="请选择">
								<el-option v-for="item in statusOptions" :key="item" :label="item" :value="item" />
							</el-select>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item :label="t('message.layout.location')" prop="pageviews">
							<el-input v-model="tempArticleModel.pageviews" />
						</el-form-item>
					</el-col>
				</el-row>
				<el-form-item label="备注" prop="fullContent">
					<el-input v-model="tempArticleModel.fullContent" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" placeholder=" 信息" />
				</el-form-item>
			</el-form>
			<div class="dialog-footer">
				<el-button @click="dialogFormVisible = false">
					{{ t('message.layout.cancel') }}
				</el-button>
				<el-button type="primary" @click="dialogStatus === 'create' ? createData() : updateData()">
					{{ t('message.layout.confirm') }}
				</el-button>
				<el-button type="primary" @click="handleDelete()">
					{{ t('message.layout.delete') }}
				</el-button>
			</div>
		</el-dialog>
		<el-dialog v-model="searchDianPopVisible" title="创建搜索点">
			<el-form label-position="left" label-width="60px" style="width: 350px">
				<el-form-item label="地名">
					<el-input v-model="addsearchName" placeholder="请输入地名" />
				</el-form-item>
			</el-form>
			<div class=" h-5"></div>
			<div class="dialog-footer">
				<el-button @click="searchDianPopVisible = false">
					{{ t('message.layout.cancel') }}
				</el-button>
				<el-button type="primary" @click="tapAddSearchDian" >
					添加
				</el-button>
				
			</div>
		</el-dialog>
        <ZhanbeiDialog @delData="delZhanbei" @updateData="updateZhanbei" @createData="createZhanbei" @clearNewDian="clearNewZhanbei" ref="dialogPop" v-model="zhanbeiVisible" v-model:dialogStatus="zhanbeiDialogStatus"></ZhanbeiDialog>
        <ZhuanyeDialog @delData="delZhuanye" @updateData="updateZhuanye" @createData="createZhuanye" @clearNewDian="clearNewZhuanye" ref="zhuanyedialogPop" v-model="zhuanyeVisible" v-model:dialogStatus="zhuanyeDialogStatus"></ZhuanyeDialog>
        <ZhihuiDialog @delData="delZhihui" @updateData="updateZhihui" @createData="createZhihui" @clearNewDian="clearNewZhihui" ref="zhihuidialogPop" v-model="zhihuiVisible" v-model:dialogStatus="zhihuiDialogStatus"></ZhihuiDialog>
        <ComplexDialog @delData="delJingji" @updateData="updateJingji" @createData="createJingji" @clearNewDian="clearNewJIngji" ref="jingjidialogPop" v-model="jingjiVisible" v-model:dialogStatus="jingjiDialogStatus"></ComplexDialog>
	</div>
</template>

<script lang="ts">
import { onUnmounted, toRefs, reactive, computed, onMounted, getCurrentInstance, watch, nextTick, ref, unref } from 'vue';
import * as echarts from 'echarts';
import 'echarts/extension/bmap/bmap';
import '/@/assets/baidumaptools.css';
import '/@/assets/baidupage.css';
import { useStore } from '/@/store/index';
import { echartsMapList, echartsMapData } from './mock';
import { createArticle,deleteArticle, deleteArticleByName, updateArticle, defaultArticleModel, ArticleType, getArticles } from '/@/request/articles';
import { ElForm, ElMessage } from 'element-plus';
import { useI18n } from 'vue-i18n';
import { cloneDeep } from 'lodash';
import { useRouter } from 'vue-router';
import Assert from '/@/utils/shf/Assert';
import AllMap from '/@/utils/shf/AllMap';
import { deepClone } from '/@/utils/deepClone';
import { ElLoading } from 'element-plus';
import ZhanbeiDialog from '../../../views/table/components/ZhanbeiDialog.vue';
import ZhuanyeDialog from '../../../views/table/components/ZhuanyeDialog.vue';
import ZhihuiDialog from '../../../views/table/components/ZhihuiDialog.vue';
import ComplexDialog from '../../../views/table/components/ComplexDialog.vue';
import SchemeMap from '/@/utils/shf/SchemeMap';

export default {
	name: 'ybdyMap',
	components: {ZhanbeiDialog,ZhuanyeDialog,ZhihuiDialog,ComplexDialog},
	setup() {
		let schemeLinesArr = [];

		const dialogPop = ref(null);
		const zhuanyedialogPop = ref(null);
		const zhihuidialogPop = ref(null);
		const jingjidialogPop = ref(null);

		const optValue: { value: any } = ref([]);
		const optValueBefore: any[] = [];

		const toolOptValue = ref('');

		const beforeToolOptValue = ref('');

		const { t } = useI18n();
		const store = useStore();
		const { proxy } = getCurrentInstance();
		const router = useRouter();

		const lastPnt = { x: 0, y: 0 };

		const addSearchPos = {lng:0,lat:0};

		let currentSugItems:any = null;

		const dataForm = ref(ElForm);
		const state = reactive({
			addsearchName:"",
			searchDianPopVisible:false,
			zhuanyeVisible:false,
			zhanbeiVisible:false,
			zhihuiVisible:false,
			jingjiVisible:false,
			zhanbeiDialogStatus:'',
			zhuanyeDialogStatus:'',
			zhihuiDialogStatus:'',
			jingjiDialogStatus:'',
			cities: [
				{
					value: '集结点',
					label: '集结点',
				},
				{
					value: '疏散路线',
					label: '疏散路线',
				},
				{
					value: '疏散地域',
					label: '疏散地域',
				},
				{
					value: '隐蔽地域',
					label: '隐蔽地域',
				},
				{
					value: '警报点',
					label: '警报点',
				},
				{
					value: '物资点',
					label: '物资点',
				},
				{
					value: '队伍点',
					label: '队伍点',
				},
				{
					value: '人防点',
					label: '人防点',
				},
				{
					value: '经济目标',
					label: '经济目标',
				},
			],
			toolOptions: [
				{
					value: '加集结点',
					label: '加集结点',
				},
				{
					value: '加疏散路线',
					label: '加疏散路线',
				},
				{
					value: '加疏散地域',
					label: '加疏散地域',
				},
				{
					value: '加隐蔽地域',
					label: '加隐蔽地域',
				},
				{
					value: '加警报点',
					label: '加警报点',
				},
				{
					value: '加物资点',
					label: '加物资点',
				},
				{
					value: '加队伍点',
					label: '加队伍点',
				},
				{
					value: '加人防点',
					label: '加人防点',
				},
				{
					value: '加经济目标',
					label: '加经济目标',
				}
			],
			uptDelContext: {},
			isShowSelectItem: false,
			allSelectItems: ['集结点', '疏散路线', '疏散地域', '隐蔽地域', '警报点'],
			dialogStatus: '',
			rules: {
				title: [{ required: true, message: 'title is required', trigger: 'blur' }],
				status: [{ required: true, message: 'area is required', trigger: 'change' }],
			},
			statusOptions: ['市人防', '市防疫', '区人防'],
			tempArticleModel: defaultArticleModel,
			dialogFormVisible: false,
			pageType: proxy.$route.query.type,
			pageName: proxy.$route.query.name,
			echartsMapList,
			echartsMapData,
			curRouteIndex: 'bus',
			showLuxian: false,
			showToolsBox: false,
			isMarkActive: false,
			isShouhuiActive: false,
			searchContent: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			isSetsearchContent: false,
			isSetqizhongContent: false,
			startGhLuxian: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			endGhLuxian: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			bmap: {},
			searchSugItems: [],
			isShowSearchSug: false,
			isShowQizhongSug: false,
			isStartLuxianFocus: false,
			isEndLuxianFocus: false,
			pagedata: {
				currentPage: 1,
				pageCount: 1000,
			},
			nullSugItem: {
				address: '警告!!无此POI数据',
				longitude: 0.0,
				latitude: 0.0,
			},
			curSearchPoint: {},
			curSearchMarker: {},

			startGhLuxianPoint: {},
			endGhLuxianPoint: {},
			ghLuxianPolyline: {},
			bmapPoints: [],
			bmapOverlays: [],
			getTblData: {},

			/////////////////集结点.etc//////////////
			jijieDian: [],
			wuziDian:[],
			zhanyeDian:[],
			zhihuiDian:[],
			baozhangDian: [],
			jingjiDian:[],

			shusanLuxianData: [],
			luxianDian: [],
			currentLxDian: [],

			shusandiyuDian: [],
			currentSsdyDian: [],
			shusanDiyuData: [],

			yinbidiyuDian: [],
			currentYbdyDian: [],
			yinbiDiyuData: [],

			schemeLines:[],

			isMouseDown: false,
			myChart: {},
		});

		const dftSeriesLinesData = {
			name: 'tempLinesDataNameLhc',
			coords: [],
		};


		const dftSeriesScatterDataName = 'tempScatterDataNameLhc';
		/*
		watch((event)=>event.currentTarget.getAttribute('map-on-click'),(val)=>{
		});
*/
		watch(
			() => state.searchContent.address,
			async (val) => {
				if (state.isSetsearchContent) {
					state.isSetsearchContent = false;
				} else {
					if (val.length > 1) {
						state.pagedata.address = val;
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							state.searchSugItems = [];
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
							if (state.searchSugItems.length == 0) {
								state.searchSugItems.push(state.nullSugItem);
							}
						});

						state.isShowSearchSug = true;
					} else {
						state.isShowSearchSug = false;
					}
				}
			}
		);

		watch(
			() => state.startGhLuxian.address,
			async (val) => {
				if (state.isSetqizhongContent) {
					state.isSetqizhongContent = false;
				} else {
					if (val.length > 1) {
						state.pagedata.address = val;
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							state.searchSugItems = [];
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
							if (state.searchSugItems.length == 0) {
								state.searchSugItems.push(state.nullSugItem);
							}
						});
						state.isShowQizhongSug = true;
					} else {
						state.isShowQizhongSug = false;
						state.startGhLuxian.longitude = 0.0;
						state.startGhLuxian.latitude = 0.0;
						if (state.ghLuxianPolyline) {
							state.bmap.removeOverlay(state.ghLuxianPolyline);
							delete state.ghLuxianPolyline;
						}
					}
				}
			}
		);

		watch(
			() => state.endGhLuxian.address,
			async (val) => {
				if (state.isSetqizhongContent) {
					state.isSetqizhongContent = false;
					//start search
				} else {
					if (val.length > 1) {
						state.pagedata.address = val;
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							state.searchSugItems = [];
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
							if (state.searchSugItems.length == 0) {
								state.searchSugItems.push(state.nullSugItem);
							}
						});
						state.isShowQizhongSug = true;
					} else {
						state.isShowQizhongSug = false;
						state.endGhLuxian.longitude = 0.0;
						state.endGhLuxian.latitude = 0.0;

						if (state.ghLuxianPolyline) {
							state.bmap.removeOverlay(state.ghLuxianPolyline);
							delete state.ghLuxianPolyline;
						}
					}
				}
			}
		);

		watch(
			() => state.dialogFormVisible,
			(val) => {
				if (!val) {
					if (state.dialogStatus == 'create') {
						clearTmpDian(toolOptValue.value.substring(1));
					}
				}
			}
		);

		const clearTmpDian = (status: string) => {
			let delDian = [];
			switch (status) {
				case '集结点':
					{
						for (let i = 0; i < state.jijieDian.length; i++) {
							let ele = state.jijieDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.jijieDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '集结点',
										data: state.jijieDian,
									},
								],
							});
						}
					}
					break;
				case '警报点':
					{
						for (let i = 0; i < state.baozhangDian.length; i++) {
							let ele = state.baozhangDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.baozhangDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '警报点',
										data: state.baozhangDian,
									},
								],
							});
						}
					}
					break;
				case '疏散路线':
					{
						//路线点
						delDian = [];
						for (let i = 0; i < state.luxianDian.length; i++) {
							let ele = state.luxianDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.luxianDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '路线点',
										data: state.luxianDian,
									},
								],
							});
						}
						//路线
						delDian = [];
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.shusanLuxianData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散路线',
										data: state.shusanLuxianData,
									},
								],
							});
						}
					}
					break;
				case '疏散地域':
					{
						//地域点
						delDian = [];
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.shusandiyuDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域点',
										data: state.shusandiyuDian,
									},
								],
							});
						}
						//地域
						delDian = [];
						for (let i = 0; i < state.shusanDiyuData.length; i++) {
							let ele = state.shusanDiyuData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.shusanDiyuData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域',
										data: state.shusanDiyuData,
									},
								],
							});
						}
						beforeToolOptValue.value = '';
						toolOptValue.value = '';
					}
					break;
				case '隐蔽地域':
					{
						//地域点
						delDian = [];
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.yinbidiyuDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域点',
										data: state.yinbidiyuDian,
									},
								],
							});
						}
						//地域
						delDian = [];
						for (let i = 0; i < state.yinbiDiyuData.length; i++) {
							let ele = state.yinbiDiyuData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.yinbiDiyuData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域',
										data: state.yinbiDiyuData,
									},
								],
							});
						}
						beforeToolOptValue.value = '';
						toolOptValue.value = '';
						
					}
					break;
			}
		};

		const tapAddSearchDian = async ()=>{
			if(state.addsearchName == ""){
				Assert.isFalse(true,"未输入地名");
				return;
			}
			const articleId= await createArticle({address:state.addsearchName,longitude:""+addSearchPos.lng,latitude:addSearchPos.lat},ArticleType.MAPPOI);
			state.searchDianPopVisible = false;
			ElMessage.success('添加成功');
		}

		const setSelectItem = (selItem) => {
			state.isShowSelectItem = false;
			let str = '/menu/menu1/menu12/menu121';

			switch (selItem) {
				case '集结点':
					{
						str = '/menu/menu1/menu12/menu121';
					}
					break;
				case '疏散路线':
					{
						str = '/menu/menu1/menu12/menu122';
					}
					break;
				case '疏散地域':
					{
						str = '/menu/menu1/menu12/menu123';
					}
					break;
				case '隐蔽地域':
					{
						str = '/menu/menu1/menu12/menu124';
					}
					break;
				case '警报点':
					{
						str = '/menu/menu1/menu12/menu125';
					}
					break;
				case '经济目标':
					{
						str = '/menu/menu1/menu12/menu126';
					}
					break;
			}

			router.push({
				path: str,
				query: { type: selItem, name: '' },
			});
		};

		const searchBoxFocus = () => {
			if (state.showLuxian) state.showLuxian = false;
			if (state.showToolsBox) state.showToolsBox = false;
		};

		const startGhLuxianFocus = () => {
			state.isStartLuxianFocus = true;
			state.isEndLuxianFocus = false;
		};

		const endGhLuxianFocus = () => {
			state.isStartLuxianFocus = false;
			state.isEndLuxianFocus = true;
		};

		const setSearchInput = (sugItem) => {
			state.isShowSearchSug = false;

			if (sugItem.longitude != 0.0) {
				state.isSetsearchContent = true;
				state.searchContent = sugItem;

				state.curSearchPoint.lng = sugItem.longitude;
				state.curSearchPoint.lat = sugItem.latitude;
				state.bmap.centerAndZoom(state.curSearchPoint, 19);

				// 创建标注
				state.curSearchMarker.point = state.curSearchPoint;
				state.bmap.addOverlay(state.curSearchMarker);
			}
		};

		const closeSearchContent = () => {
			state.searchContent.address = '';
			state.searchContent.longitude = state.searchContent.latitude = 0.0;
			state.bmap.removeOverlay(state.curSearchMarker);
		};

		const setQizhongdianInput = (sugItem) => {
			state.isSetqizhongContent = true;
			state.isShowQizhongSug = false;

			if (state.isStartLuxianFocus) {
				if (sugItem.longitude != 0.0) {
					state.startGhLuxian = sugItem;
					//start search
					if (state.endGhLuxian.longitude != 0.0) {
						state.startGhLuxianPoint.lng = sugItem.longitude;
						state.startGhLuxianPoint.lat = sugItem.latitude;
						state.endGhLuxianPoint.lng = state.endGhLuxian.longitude;
						state.endGhLuxianPoint.lat = state.endGhLuxian.latitude;

						var polyline = new BMap.Polyline([state.startGhLuxianPoint, state.endGhLuxianPoint], {
							strokeColor: 'red',
							strokeWeight: 6,
							strokeOpacity: 0.5,
						});
						state.ghLuxianPolyline = polyline;
						state.bmap.addOverlay(polyline);
						/*
			  			state.ghLuxianPolyline=BMap.Polyline([
			  			state.startGhLuxianPoint,state.endGhLuxianPoint],
			  			{strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5});
			  			state.bmap.addOverlay(state.ghLuxianPolyline);*/
					}
				}
			} else if (state.isEndLuxianFocus) {
				if (sugItem.longitude != 0.0) {
					state.endGhLuxian = sugItem;
					//start search
					if (state.startGhLuxian.longitude != 0.0) {
						state.startGhLuxianPoint.lng = state.startGhLuxian.longitude;
						state.startGhLuxianPoint.lat = state.startGhLuxian.latitude;
						state.endGhLuxianPoint.lng = sugItem.longitude;
						state.endGhLuxianPoint.lat = sugItem.latitude;

						var polyline = new BMap.Polyline([state.startGhLuxianPoint, state.endGhLuxianPoint], {
							strokeColor: 'red',
							strokeWeight: 6,
							strokeOpacity: 0.5,
						});
						state.ghLuxianPolyline = polyline;
						state.bmap.addOverlay(polyline);

						/*
			  			state.ghLuxianPolyline=BMap.Polyline([
			  			state.startGhLuxianPoint,state.endGhLuxianPoint],
			  			{strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5});
			  			state.bmap.addOverlay(state.ghLuxianPolyline);*/
					}
				}
			}

			//start to
		};

		const clickGhLuxian = () => {
			state.showLuxian = !state.showLuxian;

			if (state.showLuxian) {
				state.endGhLuxian.address = '';
				state.startGhLuxian.address = '';
				state.isShowSearchSug = false;
				if (state.showToolsBox) {
					state.showToolsBox = false;
					state.isMarkActive = false;
					state.isShouhuiActive = false;
				}
			} else {
				state.startGhLuxian.address = state.endGhLuxian.address = '';
			}

			//start luxian
		};

		const changeRouteIndex = (event) => {
			state.curRouteIndex = event.currentTarget.getAttribute('data-index');
		};

		const searchAddr = () => {
			if(currentSugItems == null)return;
			if(state.searchContent.address == currentSugItems.address)
			{
				if (currentSugItems.longitude != 0.0) {
				state.isSetsearchContent = true;
				state.searchContent = currentSugItems;

				state.curSearchPoint.lng = currentSugItems.longitude;
				state.curSearchPoint.lat = currentSugItems.latitude;
				state.bmap.centerAndZoom(state.curSearchPoint, 19);

				// 创建标注
				state.curSearchMarker.point = state.curSearchPoint;
				state.bmap.addOverlay(state.curSearchMarker);
			}
			}
		};

		const loadTypeName = async () => {
			const loadingInstance1 = ElLoading.service({ lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.7)' });

			let point = new BMap.Point(window['gLongitudeVal'], window['gLatitudeVal']);
			if (proxy.$route.query.lng && proxy.$route.query.lat) {
				point.lng = proxy.$route.query.lng;
				point.lat = proxy.$route.query.lat;
			}

			state.bmap.centerAndZoom(point, 19);

			state.getTblData = {};
			(state.getTblData as any).data = [];
			await SchemeMap.displayJiJie(state);
			await SchemeMap.delay(200);
			// await AllMap.displayLuxian(state);
			// await AllMap.delay(200);
			// await AllMap.displaySuSanDiYu(state);
			// await AllMap.delay(200);
			// await AllMap.displayYinBiDiyu(state);
			// await AllMap.delay(200);
			// await AllMap.displayBaoZhangDian(state);
			// await AllMap.delay(200);
			// await AllMap.displaWuZiDian(state);
			// await AllMap.delay(200);
			// await AllMap.displayZhanyeDian(state);
			// await AllMap.delay(200);
			// await AllMap.displayZhihuiDian(state);
			// await AllMap.delay(200);
			// await AllMap.displayJinjiDian(state);

			loadingInstance1.close();

			for (const vo of state.cities) {
				optValue.value.push(vo.value);
				optValueBefore.push(vo.value);
			}
			if (state.pageType == '集结点') {
				optValue.value = ['集结点'];
				onChangeOpt(['集结点']);
				return;
			}
			if (state.pageType == '疏散路线') {
				optValue.value = ['疏散路线'];
				onChangeOpt(['疏散路线']);
				return;
			}
			if (state.pageType == '疏散地域') {
				optValue.value = ['疏散地域'];
				onChangeOpt(['疏散地域']);
				return;
			}
			if (state.pageType == '隐蔽地域') {
				optValue.value = ['隐蔽地域'];
				onChangeOpt(['隐蔽地域']);
				return;
			}
			if (state.pageType == '警报点') {
				optValue.value = ['警报点'];
				onChangeOpt(['警报点']);
				return;
			}
			if (state.pageType == '物资点') {
				optValue.value = ['物资点'];
				onChangeOpt(['物资点']);
				return;
			}
			if (state.pageType == '队伍点') {
				optValue.value = ['队伍点'];
				onChangeOpt(['队伍点']);
				return;
			}
			if (state.pageType == '人防点') {
				optValue.value = ['人防点'];
				onChangeOpt(['人防点']);
				return;
			}
			if (state.pageType == '经济目标') {
				optValue.value = ['经济目标'];
				onChangeOpt(['经济目标']);
				return;
			}
		};

		const resetTempArticleModel = () => {
			state.tempArticleModel = cloneDeep(defaultArticleModel);
			state.tempArticleModel.importance = state.pageType;
			state.dialogStatus = 'create';
			/*
        	nextTick(() => {
	          (dataForm.value as typeof ElForm).clearValidate();
	        });
	        */
		};

		const editDialogShowByLoc = (offsetx, offsety) => {
			let el = proxy.$refs.elybdymapDialog;
			if (el) {
				let locx, locy;
				if (offsetx > 1120) locx = 1170;
				else locx = offsetx + 50;
				el.style.left = locx + 'px';

				if (offsety > 300) locy = offsety - 300;
				else locy = offsety + 70;
				el.style.top = locy + 'px';

				ElMessage.success(offsetx + ',' + offsety);
				state.dialogFormVisible = true;
			}
		};
		const clearNewZhanbei = async ()=>{
			let delDian = [];
			for (let i = 0; i < state.wuziDian.length; i++) {
							let ele = state.wuziDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.wuziDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '物资点',
										data: state.wuziDian,
									},
								],
							});
						}
		}
		const clearNewZhuanye = async ()=>{
			let delDian = [];
			for (let i = 0; i < state.zhanyeDian.length; i++) {
							let ele = state.zhanyeDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.zhanyeDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '队伍点',
										data: state.zhanyeDian,
									},
								],
							});
						}
		}
		const clearNewZhihui = async ()=>{
			let delDian = [];
			for (let i = 0; i < state.zhihuiDian.length; i++) {
							let ele = state.zhihuiDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.zhihuiDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '人防点',
										data: state.zhihuiDian,
									},
								],
							});
						}
		}
		const clearNewJIngji = async ()=>{
			let delDian = [];
			for (let i = 0; i < state.jingjiDian.length; i++) {
							let ele = state.jingjiDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.jingjiDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '经济目标',
										data: state.jingjiDian,
									},
								],
							});
						}
		}
		const createZhanbei = async (tempArticleModel:any,rowlist:any)=>{
				let ret = 0;
				let upt = 0;
				let idx = 0;
					for (let i = 0; i < state.wuziDian.length; i++) {
						let ele = state.wuziDian[i];
						if (ele.name == '') {
							tempArticleModel.sourceURL = ele.value[0];
							tempArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						const articleId=await createArticle({...tempArticleModel,fullContent:JSON.stringify(rowlist)},ArticleType.ZBWZ);
						// state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						// state.dialogStatus = 'success';
						state.wuziDian[idx].name = tempArticleModel.title;
						tempArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(tempArticleModel));
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '物资点',
										data: state.wuziDian,
									},
								],
							});
						}
					}
					return;
		}

		const createZhihui = async (tempArticleModel:any,rowlist:any)=>{
				let ret = 0;
				let upt = 0;
				let idx = 0;
					for (let i = 0; i < state.zhihuiDian.length; i++) {
						let ele = state.zhihuiDian[i];
						if (ele.name == '') {
							tempArticleModel.sourceURL = ele.value[0];
							tempArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						const articleId=await createArticle({...tempArticleModel,fullContent:JSON.stringify(rowlist)},ArticleType.ZHJG);
						// state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						// state.dialogStatus = 'success';
						state.zhihuiDian[idx].name = tempArticleModel.title;
						tempArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(tempArticleModel));
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '人防点',
										data: state.zhihuiDian,
									},
								],
							});
						}
					}
					return;
		}
		const createJingji = async (tempArticleModel:any)=>{
				let ret = 0;
				let upt = 0;
				let idx = 0;
					for (let i = 0; i < state.jingjiDian.length; i++) {
						let ele = state.jingjiDian[i];
						if (ele.name == '') {
							tempArticleModel.sourceURL = ele.value[0];
							tempArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						tempArticleModel.type = "经济";
						tempArticleModel.importance = "经济目标";
						const articleId=await createArticle({...tempArticleModel},ArticleType.SSYS);
						// state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						// state.dialogStatus = 'success';
						state.jingjiDian[idx].name = tempArticleModel.title;
						tempArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(tempArticleModel));
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '经济目标',
										data: state.jingjiDian,
									},
								],
							});
						}
					}
					return;
		}
		const createZhuanye = async (tempArticleModel:any,rowlist:any)=>{
				let ret = 0;
				let upt = 0;
				let idx = 0;
					for (let i = 0; i < state.zhanyeDian.length; i++) {
						let ele = state.zhanyeDian[i];
						if (ele.name == '') {
							tempArticleModel.sourceURL = ele.value[0];
							tempArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						const articleId=await createArticle({...tempArticleModel,fullContent:JSON.stringify(rowlist)},ArticleType.ZYDW);
						// state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						// state.dialogStatus = 'success';
						state.zhanyeDian[idx].name = tempArticleModel.title;
						tempArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(tempArticleModel));
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '队伍点',
										data: state.zhanyeDian,
									},
								],
							});
						}
					}
					return;
		}

		const createData = async () => {
			//const form = unref(dataForm);
			let ArticleModel = state.tempArticleModel;
			let ret = 0;
			let upt = 0;
			let idx = 0;
			if (ArticleModel.title.length > 0 && ArticleModel.status.length > 0) {
				if (toolOptValue.value.substring(1) == '集结点') {
					ret = 0;
					upt = 0;
					idx = 0;
					for (let i = 0; i < state.jijieDian.length; i++) {
						let ele = state.jijieDian[i];
						if (ele.name == '') {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						ArticleModel.importance = '集结点';
						ArticleModel.type = '集结';
						let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS);
						
						
						state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						state.dialogStatus = 'success';
						state.jijieDian[idx].name = ArticleModel.title;
						ArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(ArticleModel));
						upt++;

						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '集结点',
										data: state.jijieDian,
									},
								],
							});
						}
					}
					return;
				}
				if (toolOptValue.value.substring(1) == '警报点') {
					ret = 0;
					upt = 0;
					idx = 0;
					for (let i = 0; i < state.baozhangDian.length; i++) {
						let ele = state.baozhangDian[i];
						if (ele.name == '') {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						ArticleModel.importance = '警报点';
						ArticleModel.type = '保障';
						let articleId =  await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS);
						state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						state.dialogStatus = 'success';
						state.baozhangDian[idx].name = ArticleModel.title;
						ArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(ArticleModel));
						upt++;

						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '警报点',
										data: state.baozhangDian,
									},
								],
							});
						}
					}
					return;
				}
				if (toolOptValue.value.substring(1) == '疏散路线') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					for (let i = 0; i < state.luxianDian.length; i++) {
						let ele = state.luxianDian[i];
						if (ele.name == dftSeriesLinesData.name) {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ArticleModel.importance  ='疏散路线';
							ArticleModel.type = '疏散';
							let articleId =  await createArticle(
								{ ...ArticleModel, platforms: upt },
								ArticleType.SSYS,
								createCount == 0 ? true : false
							);

							state.dialogStatus = 'success';
							state.luxianDian[i].name = ArticleModel.title;
							ArticleModel.id = articleId;
							upt++;
							createCount++;
							state.getTblData.data.push(cloneDeep(ArticleModel));
						}
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '路线点',
									data: state.luxianDian,
								},
							],
						});

						ret = 0;
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.shusanLuxianData[i].name = ArticleModel.title;
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散路线',
										data: state.shusanLuxianData,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');

					
					return;
				}

				if (toolOptValue.value.substring(1) == '疏散地域') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					for (let i = 0; i < state.shusanDiyuData.length; i++) {
						let ele = state.shusanDiyuData[i];
						if (ele.name == dftSeriesLinesData.name) {
							//ele.coords
							for (let j = 0; j < 4; j += 2) {
								let parr = ele.coords[j];
								ArticleModel.sourceURL = parr[0];
								ArticleModel.imageURL = parr[1];
								ArticleModel.importance = "疏散地域";
								ArticleModel.type = "疏散";
								let articleId =  await createArticle(
									{ ...ArticleModel, platforms: upt },
									ArticleType.SSYS,
									createCount == 0 ? true : false
								);
								state.dialogStatus = 'success';
								state.shusanDiyuData[i].name = ArticleModel.title;
								ArticleModel.id = articleId;
								state.getTblData.data.push(cloneDeep(ArticleModel));
								upt++;
								createCount++;
							}
							break;
						}
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '疏散地域',
									data: state.shusanDiyuData,
								},
							],
						});
						ret = 0;
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.shusandiyuDian[i].name = ArticleModel.title;
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域点',
										data: state.shusandiyuDian,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');

					beforeToolOptValue.value = '';
					toolOptValue.value = '';
					return;
				}

				if (toolOptValue.value.substring(1) == '隐蔽地域') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					for (let i = 0; i < state.yinbiDiyuData.length; i++) {
						let ele = state.yinbiDiyuData[i];
						if (ele.name == dftSeriesLinesData.name) {
							//ele.coords
							for (let j = 0; j < 4; j += 2) {
								let parr = ele.coords[j];
								ArticleModel.sourceURL = parr[0];
								ArticleModel.imageURL = parr[1];
								ArticleModel.importance = '隐蔽地域';
								ArticleModel.type = '隐蔽';
								let articleId =  await createArticle(
									{ ...ArticleModel, platforms: upt },
									ArticleType.SSYS,
									createCount == 0 ? true : false
								);

								state.dialogStatus = 'success';
								state.yinbiDiyuData[i].name = ArticleModel.title;
								ArticleModel.id = articleId;
								state.getTblData.data.push(cloneDeep(ArticleModel));
								upt++;
								createCount++;
							}
							break;
						}
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '隐蔽地域',
									data: state.yinbiDiyuData,
								},
							],
						});
						ret = 0;
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.yinbidiyuDian[i].name = ArticleModel.title;
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域点',
										data: state.yinbidiyuDian,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');

					beforeToolOptValue.value = '';
					toolOptValue.value = '';
					return;
				}
				return;
			} 
			ElMessage.error('请填写必填参数'); 
		};

		const compObject = (a, b) => {
			//取对象a和b的属性名
			let aProps = Object.getOwnPropertyNames(a);
			let bProps = Object.getOwnPropertyNames(b);
			//判断属性名的length是否一致
			if (aProps.length != bProps.length) {
				return false;
			}
			//循环取出属性名，再判断属性值是否一致
			for (let i = 0; i < aProps.length; i++) {
				let propName = aProps[i];
				if (a[propName] !== b[propName]) {
					return false;
				}
			}
			return true;
		};
		const delZhanbei = async (tempArticleModel)=>{
			await deleteArticle(tempArticleModel.id,ArticleType.ZBWZ).then(()=>{
				ElMessage.success({
					message: '删除成功',
					type: 'success',
					duration: 2000
				})
				let i = 0;
				for (i = 0; i < state.wuziDian.length; i++) {
						let ele = state.wuziDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					if (i != state.wuziDian.length) {
						state.wuziDian.splice(i, 1);
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: "物资点",
									data: state.wuziDian,
								},
							],
						});
					}
				}).catch(err => {
					
			 ElMessage.warning('删除失败')
	     });
		}
		const delZhuanye = async (tempArticleModel)=>{
			await deleteArticle(tempArticleModel.id,ArticleType.ZYDW).then(()=>{
				ElMessage.success({
					message: '删除成功',
					type: 'success',
					duration: 2000
				});
				let i = 0;
				for (i = 0; i < state.zhanyeDian.length; i++) {
						let ele = state.zhanyeDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					if (i != state.zhanyeDian.length) {
						state.zhanyeDian.splice(i, 1);
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: "队伍点",
									data: state.zhanyeDian,
								},
							],
						});
					}
				}).catch(err => {
					
			 ElMessage.warning('删除失败')
	     });
		}
		const delZhihui = async (tempArticleModel)=>{
			await deleteArticle(tempArticleModel.id,ArticleType.ZHJG).then(()=>{
				ElMessage.success({
					message: '删除成功',
					type: 'success',
					duration: 2000
				});
				let i = 0;
				for (i = 0; i < state.zhihuiDian.length; i++) {
						let ele = state.zhihuiDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					if (i != state.zhihuiDian.length) {
						state.zhihuiDian.splice(i, 1);
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: "人防点",
									data: state.zhihuiDian,
								},
							],
						});
					}
				}).catch(err => {
					
			 ElMessage.warning('删除失败')
	     });
		}
		const delJingji = async (tempArticleModel)=>{
			await deleteArticle(tempArticleModel.id,ArticleType.SSYS).then(()=>{
				ElMessage.success({
					message: '删除成功',
					type: 'success',
					duration: 2000
				});
				let i = 0;
				for (i = 0; i < state.jingjiDian.length; i++) {
						let ele = state.jingjiDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					if (i != state.jingjiDian.length) {
						state.jingjiDian.splice(i, 1);
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: "经济目标",
									data: state.jingjiDian,
								},
							],
						});
					}
				}).catch(err => {
					
			 ElMessage.warning('删除失败')
	     });
		}
		const updateZhanbei =async (tempArticleModel,rowlist) => {
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(rowlist);
			const data = await updateArticle({...tempArticleModel,fullContent,sourceURL: null, imageURL: null },ArticleType.ZBWZ).then(async()=>{
	        	ElMessage.success('更新成功');
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name ) {
						tempArticleModel.sourceURL = '';
						tempArticleModel.imageURL = '';
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;
						state.getTblData.data[i].fullContent = fullContent;
						state.zhanbeiVisible = false;

						let ret = false;
						for (let i = 0; i < state.wuziDian.length; i++) {
							let ele = state.wuziDian[i];
							if (ele.name == e.name) {
								ele.name = tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: "物资点",
										data: state.wuziDian,
									},
								],
							});
						}
						break;
					}
				}
					
            }).catch(err => {
		         ElMessage.warning('更新失败');
		    });
		}
		const updateZhuanye =async (tempArticleModel,rowlist) => {
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(rowlist);
			const data = await updateArticle({...tempArticleModel,fullContent,sourceURL: null, imageURL: null },ArticleType.ZYDW).then(async()=>{
	        	ElMessage.success('更新成功');
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name ) {
						tempArticleModel.sourceURL = '';
						tempArticleModel.imageURL = '';
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;
						state.getTblData.data[i].fullContent = fullContent;
						state.zhuanyeVisible = false;

						let ret = false;
						for (let i = 0; i < state.zhanyeDian.length; i++) {
							let ele = state.zhanyeDian[i];
							if (ele.name == e.name) {
								ele.name = tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: "队伍点",
										data: state.zhanyeDian,
									},
								],
							});
						}
						break;
					}
				}
					
            }).catch(err => {
		         ElMessage.warning('更新失败');
		    });
		}
		const updateZhihui = async (tempArticleModel,rowlist)=>{
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(rowlist);
			const data = await updateArticle({...tempArticleModel,fullContent,sourceURL: null, imageURL: null },ArticleType.ZHJG).then(async()=>{
	        	ElMessage.success('更新成功');
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name ) {
						tempArticleModel.sourceURL = '';
						tempArticleModel.imageURL = '';
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;
						state.getTblData.data[i].fullContent = fullContent;
						state.zhihuiVisible = false;

						let ret = false;
						for (let i = 0; i < state.zhihuiDian.length; i++) {
							let ele = state.zhihuiDian[i];
							if (ele.name == e.name) {
								ele.name = tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: "人防点",
										data: state.zhihuiDian,
									},
								],
							});
						}
						break;
					}
				}
					
            }).catch(err => {
		         ElMessage.warning('更新失败');
		    });
		}
		const updateJingji = async (tempArticleModel)=>{
			let e = state.uptDelContext;
			tempArticleModel.importance = "经济目标";
			tempArticleModel.type = "经济";
			const data = await updateArticle({...tempArticleModel,sourceURL: null, imageURL: null },ArticleType.SSYS).then(async()=>{
	        	ElMessage.success('更新成功');
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name ) {
						tempArticleModel.sourceURL = '';
						tempArticleModel.imageURL = '';
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;
						state.jingjiVisible = false;

						let ret = false;
						for (let i = 0; i < state.jingjiDian.length; i++) {
							let ele = state.jingjiDian[i];
							if (ele.name == e.name) {
								ele.name = tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: "经济目标",
										data: state.jingjiDian,
									},
								],
							});
						}
						break;
					}
				}
					
            }).catch(err => {
		         ElMessage.warning('更新失败');
		    });
		}

		const updateData = async () => {
			let e = state.uptDelContext;
			let idxArr = [];
			let equal = false;
			let oncecomp = false;
			let uptecharts = false;
			let i = 0;
			let ret = true;
			for (i = 0; i < state.getTblData.data.length; i++) {
				let ele = state.getTblData.data[i];
				if (ele.title == e.name) {
					state.tempArticleModel.id = ele.id;
					if (!oncecomp) {
						oncecomp = true;
						equal = compObject(state.tempArticleModel, ele);
					}
					if (!equal) {
						if (state.tempArticleModel.title != ele.title) uptecharts = true;
						state.tempArticleModel.sourceURL = '';
						state.tempArticleModel.imageURL = '';
						let res = await updateArticle({ ...state.tempArticleModel, sourceURL: null, imageURL: null }, ArticleType.SSYS);
						if (res) {
							Assert.isFalse(true, res + '');
						}
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(state.tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;

						
				}
			}
			state.dialogFormVisible = false;
			if (!ret) {
				ElMessage.warning('更新失败');
				return;
			}

			ElMessage.success('更新成功');

			// await getArticles(state.pagedata, ArticleType.SSYS).then((res) => {
			// 	state.getTblData = res;
			// });

			if (!uptecharts) return;

			switch (e.seriesName) {
				case '集结点':
					{
						ret = false;
						for (let i = 0; i < state.jijieDian.length; i++) {
							let ele = state.jijieDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: e.seriesName,
										data: state.jijieDian,
									},
								],
							});
						}
					}
					break;
				case '警报点':
					{
						ret = false;
						for (let i = 0; i < state.baozhangDian.length; i++) {
							let ele = state.baozhangDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: e.seriesName,
										data: state.baozhangDian,
									},
								],
							});
						}
					}
					break;

				case '路线点':
				case '疏散路线':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.luxianDian.length; i++) {
							let ele = state.luxianDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '路线点',
										data: state.luxianDian,
									},
								],
							});
						}
						//路线
						ret = false;
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散路线',
										data: state.shusanLuxianData,
									},
								],
							});
						}
					}

					break;

				case '疏散地域点':
				case '疏散地域':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域点',
										data: state.shusandiyuDian,
									},
								],
							});
						}
						//路线
						ret = false;
						for (let i = 0; i < state.shusanDiyuData.length; i++) {
							let ele = state.shusanDiyuData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域',
										data: state.shusanDiyuData,
									},
								],
							});
						}
					}
					break;

				case '隐蔽地域点':
				case '隐蔽地域':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域点',
										data: state.yinbidiyuDian,
									},
								],
							});
						}
						//路线
						ret = false;
						for (let i = 0; i < state.yinbiDiyuData.length; i++) {
							let ele = state.yinbiDiyuData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域',
										data: state.yinbiDiyuData,
									},
								],
							});
						}
					}
					break;
			}
		};

		const onChangeOpt = async (optArr: any[]) => {
			if (optArr.length == optValueBefore.length) {
				return;
			}
			if (optArr.length > optValueBefore.length) {
				for (const opt of optArr) {
					if (optValueBefore.indexOf(opt) == -1) {
						optValueBefore.push(opt);
						AllMap.add(opt, state);
						continue;
					}
				}
				return;
			}
			if (optArr.length < optValueBefore.length) {
				for (let index = optValueBefore.length - 1; index >= 0; index--) {
					const element = optValueBefore[index];
					if (optArr.indexOf(element) == -1) {
						optValueBefore.splice(index, 1);
						if (toolOptValue.value.substring(1) == element) {
							onChangeToolOpt('');
						}
						AllMap.delete(element, state);
						continue;
					}
				}

				return;
			}
		};

		const onChangeToolOpt = async (opt) => {
			if (beforeToolOptValue.value) {
				state.showToolsBox = false;
				state.isMarkActive = false;
				state.isShouhuiActive = false;
				state.currentLxDian = [];
				clearTmpDian(beforeToolOptValue.value.substring(1));
			}
			beforeToolOptValue.value = opt;
			toolOptValue.value = opt;
			if (!opt) return;

			state.showToolsBox = true;
			let status = opt.substring(1);
			addTool(status);
			if (optValueBefore.indexOf(status) == -1) {
				optValueBefore.push(status);
				optValue.value.push(status);
				AllMap.add(status, state);
			}
		};
		const addTool = (status) => {
			if (status != '集结点' && status != '警报点' && status != '物资点' && status != '队伍点' && status != '人防点' && status != '经济目标') {
				state.showToolsBox = false;
				//鼠标样式，想结束则右击，start 手绘
				state.isShouhuiActive = true;
				state.isMarkActive = false;
				// state.bmap.disableDoubleClickZoom();
				return;
			}
			state.isMarkActive = !state.isMarkActive;

			//鼠标样式，start 标记，标记一次，active=false，需要重新点击标记
			if (state.isMarkActive) {
				if (state.isShouhuiActive) {
					state.isShouhuiActive = false;
					// state.bmap.enableDoubleClickZoom();
				}
			}
		};

		const handleDelete = async () => {
			if (state.dialogStatus == 'create') {
				state.dialogFormVisible = false;
			} else {
				let e = state.uptDelContext;
				let ret = false;
				await deleteArticleByName(e.name, ArticleType.SSYS)
					.then(() => {
						ElMessage.success({
							message: '删除成功',
							type: 'success',
							duration: 2000,
						});
						ret = true;
					})
					.catch((err) => {
						ElMessage.warning('删除失败');
					});

				state.dialogFormVisible = false;
				if (!ret) return;
				let i;
				let delDian = [];
				switch (e.seriesName) {
					case '集结点':
						{
							for (i = 0; i < state.jijieDian.length; i++) {
								let ele = state.jijieDian[i];
								if (ele.name == e.name) {
									break;
								}
							}
							if (i != state.jijieDian.length) {
								state.jijieDian.splice(i, 1);
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: e.seriesName,
											data: state.jijieDian,
										},
									],
								});
							}
						}
						break;

					case '警报点':
						{
							for (i = 0; i < state.baozhangDian.length; i++) {
								let ele = state.baozhangDian[i];
								if (ele.name == e.name) {
									break;
								}
							}
							if (i != state.baozhangDian.length) {
								state.baozhangDian.splice(i, 1);
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: e.seriesName,
											data: state.baozhangDian,
										},
									],
								});
							}
						}
						break;

					case '路线点':
					case '疏散路线':
						{
							//路线点
							delDian = [];
							for (i = 0; i < state.luxianDian.length; i++) {
								let ele = state.luxianDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.luxianDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '路线点',
											data: state.luxianDian,
										},
									],
								});
							}
							//路线
							delDian = [];
							for (i = 0; i < state.shusanLuxianData.length; i++) {
								let ele = state.shusanLuxianData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.shusanLuxianData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '疏散路线',
											data: state.shusanLuxianData,
										},
									],
								});
							}
						}
						break;

					case '疏散地域点':
					case '疏散地域':
						{
							//地域点
							delDian = [];
							for (i = 0; i < state.shusandiyuDian.length; i++) {
								let ele = state.shusandiyuDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.shusandiyuDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '疏散地域点',
											data: state.shusandiyuDian,
										},
									],
								});
							}
							//地域
							delDian = [];
							for (i = 0; i < state.shusanDiyuData.length; i++) {
								let ele = state.shusanDiyuData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.shusanDiyuData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '疏散地域',
											data: state.shusanDiyuData,
										},
									],
								});
							}
						}
						break;

					case '隐蔽地域点':
					case '隐蔽地域':
						{
							//地域点
							delDian = [];
							for (i = 0; i < state.yinbidiyuDian.length; i++) {
								let ele = state.yinbidiyuDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.yinbidiyuDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '隐蔽地域点',
											data: state.yinbidiyuDian,
										},
									],
								});
							}
							//地域
							delDian = [];
							for (i = 0; i < state.yinbiDiyuData.length; i++) {
								let ele = state.yinbiDiyuData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.yinbiDiyuData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								state.myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '隐蔽地域',
											data: state.yinbiDiyuData,
										},
									],
								});
							}
						}
						break;
				}
			}
		};

		// 设置主内容的高度
		const initTagViewHeight = computed(() => {
			let { isTagsview } = store.state.themeConfig.themeConfig;
			let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
			if (isTagsViewCurrenFull) {
				return `30px`;
			} else {
				if (isTagsview) return `114px`;
				else return `80px`;
			}
		});
		// echartsMap 将坐标信息和对应物理量的值合在一起
		const convertData = (data) => {
			let res = [];
			for (let i = 0; i < data.length; i++) {
				let geoCoord = state.echartsMapData[data[i].name];
				if (geoCoord) {
					res.push({
						name: data[i].name,
						value: geoCoord.concat(data[i].value),
					});
				}
			}
			return res;
		};

		// 初始化 echartsMap
		const initEchartsMap = () => {
			const myChart = echarts.init(document.getElementById('echartsMap'), 'light');
			state.myChart = myChart;

			const option = {
				tooltip: {
					trigger: 'item',
					triggerOn:'mousemove|click'
				},
				color: ['#FF0000', '#ea7ccc'],
				bmap: {
					center: [window['gLongitudeVal'], window['gLatitudeVal']],
					zoom: 19,
					roam: true,
					mapStyle: {},
				},
				series: [
					{
						name: '集结点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.jijieDian,
						symbol: 'image://static/images/jijie.png',
						symbolSize: 40,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '经济目标',
						type: 'scatter',
						coordinateSystem: 'bmap',						
						data:state.jingjiDian,						
						symbol: "image://static/images/jingji.png",						
						symbolSize:40,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color:'#ff0000',
							fontSize:14,
						},					
					},
					{
						name: '物资点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.wuziDian,
						symbol: 'image://static/images/wu.png',
						symbolSize: 40,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '队伍点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.zhanyeDian,
						symbol: 'image://static/images/duiwu.png',
						symbolSize: 40,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '人防点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.zhihuiDian,
						symbol: 'image://static/images/zhihui.png',
						symbolSize: 40,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '警报点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.baozhangDian,
						symbol: 'image://static/images/baozhang.png',
						symbolSize: 40,
						encode: {
							value: 2,
						},

						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '路线点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.luxianDian,
						symbol: 'image://static/images/end_e68ad9a.png',
						symbolSize: 10,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							//position: 'right',
							position: 'top',
							show: false,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '疏散地域点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.shusandiyuDian,
						symbol: 'image://static/images/shusan.png',
						symbolSize: 30,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '隐蔽地域点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.yinbidiyuDian,
						symbol: 'image://static/images/yinbi.png',
						symbolSize: 30,
						encode: {
							value: 2,
						},

						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '疏散路线',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#00ff00',
							opacity: 0.8,
							width: 10,
						},
						data: state.shusanLuxianData,
					},
					{
						name: '疏散地域',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#0000ff',
							opacity: 0.6,
							width: 15,
						},
						data: state.shusanDiyuData,
					},
					{
						name: '隐蔽地域',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#ff0000',
							opacity: 0.6,
							width: 15,
						},
						data: state.yinbiDiyuData,
					}
				],
			};
			myChart.setOption(option, true);
			window.addEventListener('resize', () => {
				myChart.resize();
			});

			//lhc added
			//init
			state.curSearchPoint = new BMap.Point();
			state.curSearchMarker = new BMap.Marker();
			state.startGhLuxianPoint = new BMap.Point();
			state.endGhLuxianPoint = new BMap.Point();
			// 从echarts对象中获取bmap对象
			const bmap = (state.bmap = myChart.getModel().getComponent('bmap').getBMap());
			bmap.setMinZoom(10);
			bmap.setMaxZoom(19);

			bmap.addEventListener('click', function (e) {
				
			});

			bmap.addEventListener('rightclick', function (e) {
				if (state.isShouhuiActive) {
					// state.isShouhuiActive = false;
					state.currentLxDian = [];
					/*
		    		nextTick(() => {	    							
	          			state.bmap.enableDoubleClickZoom();
	        		});
	        		*/
					//显示对话框
					editDialogShowByLoc(e.offsetX, e.offsetY);
					resetTempArticleModel();
					return;
				}
				state.addsearchName = "";
				state.searchDianPopVisible = true;
				addSearchPos.lng = e.point.lng;
				addSearchPos.lat = e.point.lat;
			});

			bmap.addEventListener('mousemove', function (e) {
				let nowPnt = { x: 0, y: 0 };
				nowPnt.x = e.domEvent.pageX;
				nowPnt.y = e.domEvent.pageY;
				let chaPnt = { x: Math.abs(nowPnt.x - lastPnt.x), y: Math.abs(nowPnt.y - lastPnt.y) };
				if (state.isMouseDown) {
					if (state.isShouhuiActive) {
						if (toolOptValue.value.substring(1) == '疏散地域') {
							if (state.currentSsdyDian.length == 0) {
								state.currentSsdyDian.push({
									name: dftSeriesLinesData.name,
									value: [e.point.lng, e.point.lat],
								});
								state.shusandiyuDian.push({
									name: dftSeriesLinesData.name,
									value: [e.point.lng, e.point.lat],
								});
								myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '疏散地域点',
											data: state.shusandiyuDian,
										},
									],
								});
							} else {
								let startDian = state.currentSsdyDian[0];

								if (state.currentSsdyDian.length == 1) {
									state.currentSsdyDian.push({
										name: dftSeriesLinesData.name,
										value: [e.point.lng, e.point.lat],
									});
									let currentSsdyData = cloneDeep(dftSeriesLinesData);

									currentSsdyData.coords.push(
										startDian.value,
										[e.point.lng, startDian.value[1]],
										[e.point.lng, e.point.lat],
										[startDian.value[0], e.point.lat],
										startDian.value
									);

									state.shusanDiyuData.push(currentSsdyData);
								} else {
									if (chaPnt.x < 20 || chaPnt.y < 20) return;
									lastPnt.x = nowPnt.x;
									lastPnt.y = nowPnt.y;
									state.shusanDiyuData.forEach((ele) => {
										if (ele.name == dftSeriesLinesData.name) {
											ele.coords.splice(
												1,
												4,
												[e.point.lng, startDian.value[1]],
												[e.point.lng, e.point.lat],
												[startDian.value[0], e.point.lat],
												startDian.value
											);
										}
									});
									myChart.setOption({
										series: [
											{
												// 根据名字对应到相应的系列
												name: '疏散地域',
												data: state.shusanDiyuData,
											},
										],
									});
								}
								
							}
						} else if (toolOptValue.value.substring(1) == '隐蔽地域') {
							if (state.currentYbdyDian.length == 0) {
								state.currentYbdyDian.push({
									name: dftSeriesLinesData.name,
									value: [e.point.lng, e.point.lat],
								});
								state.yinbidiyuDian.push({
									name: dftSeriesLinesData.name,
									value: [e.point.lng, e.point.lat, undefined],
								});
								myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '隐蔽地域点',
											data: state.yinbidiyuDian,
										},
									],
								});
							} else {
								let startDian = state.currentYbdyDian[0];

								if (state.currentYbdyDian.length == 1) {
									state.currentYbdyDian.push({
										name: dftSeriesLinesData.name,
										value: [e.point.lng, e.point.lat],
									});
									let currentYbdyData = cloneDeep(dftSeriesLinesData);

									currentYbdyData.coords.push(
										startDian.value,
										[e.point.lng, startDian.value[1]],
										[e.point.lng, e.point.lat],
										[startDian.value[0], e.point.lat],
										startDian.value
									);

									state.yinbiDiyuData.push(currentYbdyData);
								} else {
									if (chaPnt.x < 20 || chaPnt.y < 20) return;
									lastPnt.x = nowPnt.x;
									lastPnt.y = nowPnt.y;
									state.yinbiDiyuData.forEach((ele) => {
										if (ele.name == dftSeriesLinesData.name) {
											ele.coords.splice(
												1,
												4,
												[e.point.lng, startDian.value[1]],
												[e.point.lng, e.point.lat],
												[startDian.value[0], e.point.lat],
												startDian.value
											);
										}
									});
									myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '隐蔽地域',
											data: state.yinbiDiyuData,
										},
									],
								});
								}
								
							}
						} else {
							ElMessage.error('拖动仅用于绘制地域');
						}
					}
				}
			});

			myChart.getZr().on('mousedown', (e) => {

				if (state.isShouhuiActive) {
					if (toolOptValue.value.substring(1) == '疏散地域' || toolOptValue.value.substring(1) == '隐蔽地域') {
						state.bmap.disableDragging();
						state.isMouseDown = true;
						lastPnt.x = e.event.pageX;
						lastPnt.y = e.event.pageY;
					}
				}
			});
			myChart.getZr().on('mouseup', (e) => {
				if (state.isShouhuiActive) {
					if (toolOptValue.value.substring(1) == '疏散地域' || toolOptValue.value.substring(1) == '隐蔽地域') {
						state.isShouhuiActive = false;
						state.bmap.enableDragging();
						state.isMouseDown = false;
						state.currentSsdyDian = [];
						state.currentYbdyDian = [];

						//显示对话框
						editDialogShowByLoc(e.offsetX, e.offsetY);
						resetTempArticleModel();
					}
				}
			});

			myChart.on('click', (e) => {
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name) {
						for (let j = 0; j < state.jijieDian.length; j++) {
							let dian = state.jijieDian[j];
							if (dian.name == e.name) {
								dian.isSelectDian = !dian.isSelectDian;
								dian.symbol = SchemeMap.getImaData(dian.isSelectDian);
								// dian.symbolKeepAspect = true;
								schemeLinesArr.push([...dian.value]);
								break;
							}
						}
						if(schemeLinesArr.length >=2)
						{
							state.schemeLines.push({coords:[...schemeLinesArr],lineStyle:{normal:{color:'rgba(223,90,90,1)'}}});
							schemeLinesArr = [];
							state.jijieDian.forEach((value)=>{
								value.isSelectDian = false;
								value.symbol = SchemeMap.getImaData(value.isSelectDian);
							});
						}
						let lines = SchemeMap.updateSchemeLines(state.schemeLines);
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: "集结点",
									data: state.jijieDian,
								},
								...lines
							],
						});
						break;
					}
				}
			});

			//test start

			//test end
		};
		// 页面加载时
		onMounted(async () => {
			await initEchartsMap();
			loadTypeName();
		});
		onUnmounted(() => {
			state.myChart.dispose();
		});
		return {
			initTagViewHeight,
			...toRefs(state),
			changeRouteIndex,
			searchAddr,
			clickGhLuxian,
			setSearchInput,
			setQizhongdianInput,
			startGhLuxianFocus,
			endGhLuxianFocus,
			searchBoxFocus,
			closeSearchContent,
			t,
			handleDelete,
			createData,
			updateData,
			setSelectItem,
			optValue,
			toolOptValue,
			onChangeOpt,
			onChangeToolOpt,
			dialogPop,
			updateZhanbei,
			createZhanbei,
			clearNewZhanbei,
			delZhanbei,
			zhuanyedialogPop,
			createZhuanye,
			updateZhuanye,
			delZhuanye,
			clearNewZhuanye,
			delZhihui,
			updateZhihui,
			createZhihui,
			clearNewZhihui,
			zhihuidialogPop,
			jingjidialogPop,
			clearNewJIngji,
			createJingji,
			updateJingji,
			delJingji,
			tapAddSearchDian
		};
	},
};
</script>
<style lang="scss" scoped>
::v-deep .el-select-dropdown__wrap{
    max-height: 100% !important;
 }
</style>

